package org.liuyunfeng.web;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author: TanJingyu
 * @create: 2022-06-22 10:51
 **/
@RestController
@RequestMapping("/dataTime")
public class DateTimeController {

    @PostMapping
    public Object dateTime(@RequestBody DateTimeDTO dateTimeDTO) {
        System.out.println(dateTimeDTO);
        return dateTimeDTO;

    }

    @Getter
    @Setter
    @ToString
    public static class DateTimeDTO {
        @JsonFormat(timezone = "GMT-8")
        private Date birth;


        public void setBirth(Date birth) {
            this.birth = birth;
        }
    }
}

    